package com.huateng.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * Refresh Config
 *
 * @author Evan
 * @create 2021/6/13 10:14
 */
@RestController
@RequestMapping("/refresh")
@RefreshScope
@ApiIgnore
public class PreRefreshController {

    //刷新配置POST请求
    //http://localhost:30001/actuator/refresh

    @Value("${pre.env}")
    private String env;

    @Value("${pre.datasource}")
    private String datasource;

    @Value("${spring.profiles.active}")
    private String active;

    @GetMapping("/getEnv")
    public String getEnv(){
        return env;
    }

    @GetMapping("/getDatasource")
    public String getDatasource(){
        return datasource;
    }

    @GetMapping("/getActive")
    public String getActive(){
        return active;
    }

}
